package main

import (
	"database/sql"
	"fmt"
	"github.com/yourusername/gox/pkg/runtime"
)

func ComprehensiveTest(db *sql.DB) {
	query1 := func() *runtime.Query {
		__gox_sql_3_builder := runtime.NewQueryBuilder()
		__gox_sql_3_builder.AddText(" SELECT * FROM users WHERE active = 1 ")
		__gox_sql_3 := __gox_sql_3_builder.Build()
		return __gox_sql_3
	}()
	fmt.Println("Query 1:", query1.String())

	userID := 123
	query2 := func() *runtime.Query {
		__gox_sql_2_builder := runtime.NewQueryBuilder()
		__gox_sql_2_builder.AddText(" SELECT * FROM users WHERE id = ")
		__gox_sql_2_builder.AddParam(userID)
		__gox_sql_2 := __gox_sql_2_builder.Build()
		return __gox_sql_2
	}()
	fmt.Println("Query 2:", query2.String())

	tableName := "users"
	query3 := func() *runtime.Query {
		__gox_sql_1_builder := runtime.NewQueryBuilder()
		__gox_sql_1_builder.AddText(" SELECT * FROM ")
		__gox_sql_1_builder.AddText(fmt.Sprintf("%v", tableName))
		__gox_sql_1_builder.AddText(" WHERE active = ")
		__gox_sql_1_builder.AddParam(true)
		__gox_sql_1 := __gox_sql_1_builder.Build()
		return __gox_sql_1
	}()
	fmt.Println("Query 3:", query3.String())

	fmt.Println("Testing nested SQL:")
	query5 := func() *runtime.Query {
		__gox_sql_0_builder := runtime.NewQueryBuilder()
		__gox_sql_0_builder.AddText(" SELECT * FROM users WHERE id IN ( ")
		if __result := func() (__result interface{}) {
			return func() *runtime.Query {
				__nested_sql_0_builder := runtime.NewQueryBuilder()
				__nested_sql_0_builder.AddText(" SELECT 1 ")
				__nested_sql_0 := __nested_sql_0_builder.Build()
				return __nested_sql_0
			}()
			return __result
		}(); __result != nil {
			__gox_sql_0_builder.AddText(fmt.Sprintf("%v", __result))
		}
		__gox_sql_0_builder.AddText(" ) ")
		__gox_sql_0 := __gox_sql_0_builder.Build()
		return __gox_sql_0
	}()
	fmt.Println("Query 5:", query5.String())
}

func main() {
	fmt.Println("Testing comprehensive syntax")
	ComprehensiveTest(nil)
}
